Current Version: 2.0 Implements WYSIWIG HTML! (see What's New in Version 2 and Version History) Last updated: 8 Mar 1995
Legalese: These macros are free for personal, non-profit, or educational use. The software is provided 'as is' without express or implied warranties.
Nisus is a fantastic word processor for HTML writing because styled documents can be served directly, and its search/replace and non-contiguous selection features are outstanding. Here is a set of Nisus macros to assist World Wide Web authors to generate HTML documents. These "janus" macros run unmodified in both version 3.25 and version 4 (NisusWriter).
These macros are designed for an author who is comfortable with HTML tags. There is no reliance on style information whatsoever. Use of styles of course is not precluded. Personally, I find that applying stylenames, and then having these translated to html tags in some way imposes an unnecessary extra step. I prefer to work directly with html and test appearance in a real browser, rather than simulated wysiwyg mode. So I wrote these macros.
If you prefer being able to see the HTML tags as you write HTML, I hope you find these macros useful. If you do use them, please email me at ssilcot@www.unimelb.edu.au. Thanks to all the people who mailed me about earlier releases - your feedback encourages me to continue to support these macros.
New in Version 2: It may be useful to have WYSIWIG visual cues in editing html. Version 2 now optionally supports styled html editing. In styled editing mode, when you run a macro to insert HTML tags, the replacement is made attribute sensitive to the defined character stylenames in the macrosheet. If you prefer working with plain text, you may continue to do so by leaving styled editing turned off. Let me explain this a little more. Text between and including the angle brackets eg. <...> is a HTML tag. Running the macro *Apply HTML Styles
will apply the *tag
style to all such HTML tags regardless of whether styled mode editing is on or off. If you have styled editing mode turned on, the text in-between the opening and closing tags will also have an appropriate style applied "on the fly" by the tag inserting macros where appropriate eg. *H1
, or *strong
will apply styles, wheras the macros for list items and paragraphs do not.
The macros are distributed with styled editing OFF. If you want to try the styled editing, PLEASE read the documentation on styled mode first (or you might be surprised by the results). Enable styled editing by running the macro named *HTML Styles ON in Macros
. To see what the distributed defined styles do, open a copy of a HTML document, run the *Apply HTML Styles
macro, and be patient! Then toggle the display of Invisible Text on and off.
Enjoy!
Here's how to obtain and install the macros:
Download the package
The package is available for anonymous ftp from ftp://cwis.unimelb.edu.au/pub/tools/mac/ssHTMLNisusMacros2.0.sea.hqx.
The package, a binhexed self-extracting-archive, contains:
SilcotsHTMLMacrosReadMe.html
SilcotsHTMLjanusMacros
: The HTML macro suite.HTML Keyboard Shortcuts Setup
: Contains macros which will automatically define keyboard shortcuts for each macro in the suite.Install keyboard preferences.
HTML Keyboard Shortcuts Setup
. Execute the macro named <aaMake Shortcuts V3>
or <aaMake Shortcuts V4>
depending on which version of Nisus you use. These assignments can be removed with the macro <aaREMOVE Shortcuts Vn>
. The keyboard shortcuts assigned are noted below.Customise the macro suite
Open and Edit the macro file SilcotsHTMLjanusMacros
. Customise the macros <aTemplate Footer...>
and <aTemplate Header...>
(not needed if you prefer to use a stationery document.). See also instructions for customising defined character styles for the HTML tags.
Turn on styled editing (optional)
If you want to use styled editing, you must run the macro *HTML Styles ON in Macros
(The macros are distributed with styled mode editing OFF).
You are now ready to start writing HTML.
Note: The shortcuts in the distribution reflect my preferences, not yours! I have tended to choose an abbreviation of the HTML tag name because I am familiar with the tags. The macros are named so that, usually, the uppercase letters in the name give visual reminder for the distributed shortcuts eg. The macro named <CIte>
has shortcut command-option-CI.
If you wish to assign different shortcuts, modify <aaMake Shortcuts Vn>
as required before running it, or modify them later as required using Nisus' Menu Keys command (Thanks to Jonathon Delacour for comments on my implementation of keyboard shortcuts).
These "janus" macros run unmodified in both version 3.25 and version 4 (NisusWriter). You do NOT need to run the Nisus Writer conversion macro. They have been tested on 3.25 Nisus and 4.05 NisusWriter. Please notify the author if there are problems running on versions in-between these.
Probably the most powerful feature of these macros is that they are designed to support Nisus' non-contiguous selections. eg. using command-option selections, or a find command, to select all your level 2 headings, then simply execute the <h2>
macro. All the selected headings will now be wrapped with h2 tags.
Includes:
Form tags not supported yet.
Includes: individual marking of list items (<li> tag only), list wrapper tags only for <ol>, <ul>, <dl> type lists, or wrappers as well as list item marking in one command. Two discursive list macros provided to enable dt/dd parts to be delimited by tabs or returns. Includes a macro to quickly convert all bulleted paragraphs to html unordered lists (sorry, no smart list nesting yet).
These macros impose <p></p> and <li></li> syntax so your html won't break when browsers start conforming to the html DTD specs. Includes a macro to quickly convert all non-tagged or non-bulleted paragraphs to html paragraphs.
Three template macros are supplied. One inserts a header at the top of a document and prompts for a title and h1 string. One inserts a standard footer at the bottom of a document. The other simply calls the other two.
Please customise these macros as required to suit yourself.
The <Head Contents> macro generates properly nested unordered lists of all h2-6 tags in a document, including auto-calculated anchor names on headings, hypertext links on the contents items, and places the result in the clipboard for you to copy into your document (very useful for a Table of Contents section). The <Multifile Head Contents> macro works as per <Head Contents> except it works on all the files selected in the catalog window, creates a new file, and includes the level 1 heading. Again, proper hypertext referencing is done for you.
Version 2 implements, optionally, automatic styling of tags and tagged text. This feature is not, I repeat not, intended to make these macros into a Web browser! The styles are totally brain-dead when it comes to embedded lists. Please use a proper Web browser to see what your HTML will actually look like. The intention is to provide some basic visual editing assistence.
No doubt everyone is sick of setting up their shortcuts again for NisusWriter4. For your convenience, a separate macro is supplied to install keyboard shortcuts for each macro name. This works by mirroring the macro names in the actual macro file, and supplying macro code to setup shortcuts.
Simply open the macro file named HTML Keyboard Shortcuts Setup
and execute the macro named <aaMake Shortcuts> the default shortcuts are assigned.
The OPTION key is used as the modifier eg.
option-command-hc
to generate the headings contents, option-command-h2
for level 2 headings. This is easily changed in the macro itself. You only need run this once of course.
If you choose to work in styled mode, it is very important you understand how the styles have been implemented. For best results, please take the time to read the following documentation.
WARNING: when you run *Apply HTML styles
, the styles applied are NOT ADDITIVE and will replace any existing formatting. If you are working with a document containing your own stylenames or formatting which you want to retain, do NOT use the styled HTML mode (ie. execute *HTML Styles OFF in Macros
) and do NOT execute *Apply HTML styles
.
You may switch modes at any time by running *HTML Styles ON in Macros
or *HTML Styles OFF in Macros
as required. In all appropriate replace commands, styles exist in the replace text. With styled mode ON, the replacement is attribute sensitive - this will import and apply the stylename. With styled mode OFF the replacement is not attribute sensitive.
When working in styled mode, over time the styles will fragment. This can be minimised if you assign a function key to the *normal
style, and remember to press that key when adding text to the right of an opening HTML tag.
You can run *Apply HTML Styles
at any time to clean up the fragmentation.
A minimal set of defined character stylenames exist in the macro sheet (there is no use of rulers in these styles):
*Apply HTML styles
, everything is first reset to this.<pre>
, <code>
and <tt>
tags. The distributed macro file can be edited to reflect your own stylistic choices but you should not change the additive attributes on any styles. Edit the macro file and select Define Style
. Choose the style to change, make and save your changes.
If you change your mind later, the macro *Kill HTML stylenames
should be run, followed by *Apply HTML styles
, on any documents edited with your prior style formatting choices in order to bring them back in sync with the macro's formatting choices.
*tag
style invisible*Visible HTML Tags Toggle
macro*tag
style may be kept as visible, so they will always appear when editing. Disadvantages: on large documents it may take some time to execute the formatting change.*HTML to Text
macroFrankly, MOH the best option is to save your work and view it in a Web browser!
When implementing HTML styles in these macros, a critical design decision was whether or not to make the HTML stylenames additive. Additive character styles would have the advantage of better coexisting with existing non-HTML related formatting. This is important if users want a single document suitable for hardtop and Web format, and they want additional formatting beyond the scope of html tags in the print version and have used styles to achieve this. On the other hand, without additive styles there would be no way of ensuring a consistent output from the macro which applies HTML styles. For example, with additive styles, running *Apply HTML styles
a second time would actually remove the HTML styles. To get consistent output, one needs to apply formatting from a consistent base. This means killing all existing formatting.
In this release I have chosen in favour of consistency of output ie. I have implemented NON-additive HTML styles. The fact that applying HTML styles will kill any existing formatting is a conscious design choice - don't say you weren't warned! My sincere apologies if this disappoints you, but you can still make excellent use of these macros by simply using them in non-styled mode. In this case, no attributes are changed in replacements. I am painfully aware that as the designer I am imposing my own preferences. I can only say that for future releases I am receptive to expressed user opinion on whether this should change. You are of course free to make the macro's stylenames NON-additive but be warned you may be surprised with the results.
Note: I have chosen not to include any keyboard short-cuts for these style related macros in the distribution because their use and combinations will be very personal.
*Add HTML styles to Doc *Kill HTML stylenames *Apply HTML styles *Remove ALL formatting *HTML Styles OFF in Macro *Remove HTML Styles *HTML Styles ON in Macros *Visible HTML Tags Toggle *HTML to Text *No spell unstyled tags
*Add HTML styles to Doc
*Apply HTML styles
yes
to continue. These styles are controlled by the formatting choices defined in the macrosheet. The macro does alot of processing and runs very slowly on large HTML documents. *HTML Styles OFF in Macros
*HTML Styles ON in Macros
*HTML to Text
.txt
instead of .html
. *Kill HTML stylenames
*No spell unstyled tags
cmd-M
for Ignore. The macro only works if styled editing is off, as it is assumes that if you use styles you will want to retain no spelling on the *tag
style.*Remove ALL formatting
*Remove HTML Styles
*Visible HTML Tags Toggle
*tag
defined style. Very useful if you retain the visible attribute on your *tag
style.cmd-opt-vt
.This section describes what each macro concerned with inserting HTML markup tags does.
Note:
&
indicates whatever is selected when the macro is executed.<ADdress> <Anchor...> <aTEMplate document...> <aTemplate Footer...> <aTemplate Header...> <B> <BlockQuote> <BR> <CEnter> Netscape <CIte> <Code> <DD> <DL> Returns delim <DL> Tabs delim <DL> Wrapping only <DT> <DotPoints to Ulists> <EM> <FOnt...> Netscape <H1> <H2> <H3> <H4> <H5> <H6> <Head Contents> <Href...> <Href...> Internal link <HR> <I> <IMG...> <ISO translate> <ISo trans Inc <> tags> <Kill html> <Kill P in Pre> <LI> <Multifile Head Contents> <OL> <OL> Wrapping only <P> <PRE> <Returns to Paras> <strIKe> <STrong> <Title> <TT> <U> <UL> <UL> Wrapping only
<ADdress>
cmd-opt-ad
.<Anchor...>
cmd-opt-a
.<aTEMplate document...>
cmd-opt-tem
.<aTemplate Footer...>
cmd-opt-tf
.<aTemplate Header...>
cmd-opt-th
.<B>
cmd-opt-b
.<BlockQuote>
cmd-opt-bq
.<BR>
cmd-opt-br
.<CEnter> Netscape
<centre>...</center>
tag. cmd-opt-ce
.<CIte>
cmd-opt-ci
.<Code>
cmd-opt-c
.<DD>
cmd-opt-dd
.<DL> Returns delim
cmd-opt-dlr
.<DL> Tabs delim
cmd-opt-dlt
.<DL> Wrapping only
cmd-opt-dlw
.<DT>
cmd-opt-dt
.<DotPoints to Ulists>
cmd-opt-dpu
.<EM>
cmd-opt-em
.<FOnt...> Netscape
<font size=N>...</font>
tag. cmd-opt-fo
.<H1>
cmd-opt-h1
.<H2>
cmd-opt-h2
.<H3>
cmd-opt-h3
.<H4>
cmd-opt-h4
.<H5>
cmd-opt-h5
.<H6>
cmd-opt-h6
.<Head Contents>
<Href...>
cmd-opt-h
.<Href...> Internal link
cmd-opt-hi
.<HR>
<hr>
at start of all selections. Also displays a line across the screen using a named ruler and a tab mark with leading. To modify the rulers appearence, change the ruler present in the xxxRulersOnHRs
macro. Modified to support non-contiguous selection in Version 2, so now its easy to use Nisus to select, say, all <h2>
tags and insert a horizontal rule in front of all level 2 headings. cmd-opt-hr
.<I>
cmd-opt-i
.<IMG...>
cmd-opt-img
.<ISO translate>
cmd-opt-iso
.<ISo trans Inc <> tags>
cmd-opt-isi
.<Kill html>
cmd-opt-k
.<Kill P in Pre>
cmd-opt-kp
.<LI>
cmd-opt-li
.<Multifile Head Contents>
cmd-opt-hc
.<OL>
cmd-opt-ol
.<OL> Wrapping only
cmd-opt-olw
.<P>
cmd-opt-p
.<PRE>
cmd-opt-pre
.<Returns to Paras>
Unbreak lines
macro (see below). cmd-opt-rp
.<strIKe>
cmd-opt-ik
.<STrong>
cmd-opt-st
.<Title>
cmd-opt-t
.<TT>
cmd-opt-tt
.<U>
cmd-opt-u
.<UL>
cmd-opt-ul
.<UL> Wrapping only
cmd-opt-ulw
.The package includes a number of other macros not specifically concerned with HTML tags, but of convenience to HTML authors.
Add Marker Clean up returns Copy Open Pathnames Copy Pathname Create Anchor List Delete Rulers Find selection Extract RTF Stylesheet Select All HTML Select All Not HTML Select HTML Select Not HTML Unix->Mac text Unbreak Lines
Add Marker
Clean up returns
Copy Open Pathnames
Copy Pathname
Create Anchor List
Delete Rulers
Find selection
Extract RTF Stylesheet
Select All HTML
Select All Not HTML
<html>...</html>
tags, as you should. Select HTML
Select Not HTML
Unix->Mac text
Unbreak Lines
Document a Macro File
//==================== MACRO macro-name-hereat the start of each macro. The macro file contents are copied, these marker lines are picked up and the names are marked and indexed. You could modify the macro as required to suit your own convention. If you do not use this convention or modify the macro to suit your own, its results will be unpredictable.
Version 2.0, 8 Mar 1995
<CEnter> Netscape
and <FOnt...> Netscape
. Note: I have no intention of implementing further Netscape extensions.<Kill P in Pre>, Clean up returns, Create Anchor List, Select All Not HTML, Select HTML, Select Not HTML, Unix->Mac text
-S
to all find/replace
commands to enable the macros to work with non-English documents. Thankyou to Maki Watanabe for this suggestion. Note that this might cause problems with mixed-script documents. <HR>
to support non-contiguous selection.<Head Contents>
macro arbitrarily changing heads to bold has been "fixed" by new styles feature. Thanks to Ned VanderVen for reporting this.ALIGN=
attribute for images. Thanks to Ned VanderVen for reporting these.Version: 1.3, 27 Dec 1994
<Head Contents>
- it now ignores text following an end heading tag. Also makes clipboard contents plain text.Version: 1.2, 14 Dec 1994
Version 1.1 10 Dec 1994
Version 1.0 10 Nov 1994 - Initial version.
I cannot guarantee to support these macros in any way, but I will try to respond to bug reports and improvements as best I can.
Please forward all bug reports, comments, and requests to ssilcot@www.unimelb.edu.au
Silcot's Nisus HTML Macros Read Me (Official "home"). Date created: Nov 10 1994 Last modified: 8 Mar 1995 Sandra Silcot, Information Technology Services, University of Melbourne. Email: ssilcot@www.unimelb.edu.au WWW: http://www.unimelb.edu.au/~ssilcot/